     <!--焦点图专家推荐-->
     <div  class="c_fcenter f_l">
     	<!--焦点图-->
        <div class="c_focus cborder">
{php $i=0}
{loop $focusAD $f}
        	<div id="focus_{$i}" class="focusbody"><a href="{$f[image_url]}" target="_blank"><img src="{$f[image_src]}" alt="{$f[image_alt]}" /></a></div>
{php $i++}
{/loop}
        	<div class="focusfoot">
            	<ul>
{php $i=0}
{loop $focusAD $f}
                	<li id="focus_panel_{$i}" class="focuson" onclick="showfocus({$i});">{$f[title]}</li>
{php $i++}
{/loop}
                </ul>
            </div>
        </div>
<script language="">
// 广告的数目，这是全局变量
var ftotal=5;
(jQuery)(function(){
	for(var k=1;k<ftotal;k++) {
		jQuery('#focus_'+k).hide();
		jQuery('#focus_panel_'+k).removeClass('focuson').addClass('focusno');
	}
});

var fid = 0,focus_timer,click_timer;
function change_focus_timer() {
	focus_timer = setInterval(function() {
		var id=fid+1;
		if (fid==ftotal-1) {id=0;}
		jQuery('#focus_'+fid).hide();
		jQuery('#focus_'+id).show();
		jQuery('#focus_panel_'+fid).removeClass('focuson').addClass('focusno');
		jQuery('#focus_panel_'+id).removeClass('focusno').addClass('focuson');
		fid=id;
	} ,4000);
}
change_focus_timer();

function showfocus(id) {
	clearInterval(focus_timer);
	clearTimeout(click_timer);
	jQuery('#focus_'+fid).hide();
	jQuery('#focus_'+id).show();
	jQuery('#focus_panel_'+fid).removeClass('focuson').addClass('focusno');
	jQuery('#focus_panel_'+id).removeClass('focusno').addClass('focuson');
	fid=id;
	click_timer = setTimeout(function() {
		change_focus_timer();
	},2000);
}
</script>
